package com.example.rocketmqdemo.transaction.domain.transactionexecutor;

import java.util.function.Supplier;

public class LocalTransactionExecutorFactory {

    public static LocalTransactionExecutor<?> get(Runnable runnable) {
        return new DefaultLocalTransactionExecutor<>(
                () -> {
                    runnable.run();
                    return null;
                }
        );
    }

    public static <R> LocalTransactionExecutor<R> get(Supplier<R> supplier) {
        return new DefaultLocalTransactionExecutor<>(supplier);
    }
}
